package org.jinxing.velocity;

public class StringUtils extends VelocityTool{
	/**
	 * 截取字符串
	 * @param str 源字符串
	 * @param index 索引
	 * @param number 位移量
	 * @param replace
	 * @return
	 */
	public static String subString(String str,int index,int number,String replace){
		if(str==null){
			return "";
		}else if(str.length() <= index){
			return "";
		}else if(str.length() <= index + number){
			return str.substring(index);
		}else{
			return str.substring(index,index+number)+replace;
		}
	}
	
	/**
	 * 分割字符串
	 * @param str
	 * @param spliter
	 * @return
	 */
	public static String[] split(String str,String spliter){
		return str.split(spliter);
	}

	@Override
	public void initSelf() {
		
	}
	
	public static boolean isNull(Object obj){
		return obj==null?true:false;
	}
	
	public static boolean isNotNull(Object obj){
		return obj!=null?true:false;
	}
}
